<x:pager/>
<table id="bookTable" class="tablesorter">
    <thead>
        <tr>

            <th/>
            <th>${message(code: 'family.id.label', default: 'Id')}</th>
            <th>${message(code: 'family.fatherFirstName.label', default: 'Father First Name')}</th>
            <th>${message(code: 'family.fatherLastName.label', default: 'Father Last Name')}</th>
            <th>${message(code: 'family.motherFirstName.label', default: 'Mother First Name')}</th>
            <th>${message(code: 'family.motherLastName.label', default: 'Mother Last Name')}</th>
            <th>${message(code: 'family.address.label', default: 'Address')}</th>
            <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
              <th class="delete">Del</th>
              <th class="edit">Edit</th>
              <th class="edit">Payment</th>
            </g:if>

        </tr>
    </thead>
    <tbody>
    <g:each in="${instanceList}" status="i" var="familyInstance">
        <tr>

            <td>${i+1}</td>
            <td class="show"><a href="#" title="Family Detail" rel="${request.contextPath}/family/adminShow/${familyInstance.id}">${fieldValue(bean: familyInstance, field: "id")}</a></td>
            <td>${fieldValue(bean: familyInstance, field: "fatherFirstName")}</td>
            <td>${fieldValue(bean: familyInstance, field: "fatherLastName")}</td>
            <td>${fieldValue(bean: familyInstance, field: "motherFirstName")}</td>
            <td>${fieldValue(bean: familyInstance, field: "motherLastName")}</td>
            <td>${fieldValue(bean: familyInstance, field: "address")}</td>
            <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
              <td class="delete"><g:remoteLink action="adminDelete" update="content" before="if(!confirm('Are you sure?')) return false;" id="${familyInstance.id}"><span class="ui-icon ui-icon-trash"/></g:remoteLink></td>
              <td class="edit"><a href="javascript:void(0)" title="Edit Family" rel="${request.contextPath}/family/adminCreate/${familyInstance.id}"><span class="ui-icon ui-icon-pencil"/></a></td>
              <td class="edit"><a href="javascript:void(0)" onclick="$('.content').load('${request.contextPath}/family/adminPayment/${familyInstance.id}')"><span class="ui-icon ui-icon-pencil"/></a></td>
            </g:if>

        </tr>
    </g:each>
    </tbody>
</table>


<script type="text/javascript">
   setupAdminList({cluetipWidth:'600px', controller:'family', action:'list'});
</script>